/*
 * Created on 8-May-2006
 * Actualis Center
 *
 */
package org.bookie.framework.services.impl;

import java.io.IOException;
import java.util.Locale;

import org.apache.hivemind.ClassResolver;
import org.apache.tapestry.IEngine;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.engine.IEngineService;
import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.engine.IScriptSource;
import org.apache.tapestry.engine.ISpecificationSource;
import org.apache.tapestry.services.Infrastructure;
import org.apache.tapestry.spec.IApplicationSpecification;
import org.apache.tapestry.web.WebRequest;
import org.apache.tapestry.web.WebResponse;

public class EmailBaseEngine implements IEngine {

  private Infrastructure _infrastructure;
  
  /**
   * The curent locale for the engine, which may be changed at any time.
   */

  private Locale _locale;  

  public EmailBaseEngine(Infrastructure infrastructure) {
    _infrastructure = infrastructure;
  }
  
  public Locale getLocale() {
    return _locale;
  }

  public void setLocale(Locale value) {
    this._locale = value;
  }

  public IEngineService getService(String name) {
    return _infrastructure.getServiceMap().getService(name);
  }

  public IApplicationSpecification getSpecification() {
    return _infrastructure.getApplicationSpecification();
  }

  public ISpecificationSource getSpecificationSource() {
    return _infrastructure.getSpecificationSource();
  }

  public ClassResolver getClassResolver() {
    return _infrastructure.getClassResolver();
  }

  public Object getVisit() {
    return null;
  }

  public Object getVisit(IRequestCycle cycle) {
    return null;
  }

  public void setVisit(Object value) {
    //no visit    
  }

  public Object getGlobal() {
    return null;
  }

  public IScriptSource getScriptSource() {
    return _infrastructure.getScriptSource();
  }

  public IPropertySource getPropertySource() {
    return _infrastructure.getApplicationPropertySource();
  }

  public String getOutputEncoding() {
    return _infrastructure.getOutputEncoding();
  }

  public Infrastructure getInfrastructure() {
    return _infrastructure;
  }

  public void service(WebRequest request, WebResponse response) throws IOException {
    // do nothing
  }

}
